/* -+- file  ./kf2/Core/IConfiguration.cs -+- */
/*
 * kf2 jabber client
 * ~~~~~~~~~~~~~~~~~
 *
 * Copyright (C) 2006-2007 Przemysław Sitek
 * 				<przemyslaw.sitek at wp.pl> 
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

using System;

namespace Habazie.kf2.Core
{

	/// <summary>Configuration database abstraction</summary>	
	public interface IConfiguration
	{
		///<summary>Load configuration</summary>
		void Load ();
		
		///<summary>Store configuration</summary>
		void Store ();
		
		///<summary>Get integer value</summary>
		///<param name="key">Key name</param>
		int GetInt (string key);
		
		///<summary>Get boolean value</summary>
		///<param name="key">Key name</param>
		bool GetBool (string key);
		
		
		///<summary>Get integer value</summary>
		///<param name="key">Key name</param>
		string GetString (string key);
		
	
		///<summary>Set integer value</summary>
		///<param name="key">Key name</param>
		///<param name="val">New key value to be set</param>
		void SetInt (string key, int val);
		
		///<summary>Set boolean value</summary>
		///<param name="key">Key name</param>
		///<param name="val">New key value to be set</param>
		void SetBool (string key, bool val);
		
		///<summary>Set integer value</summary>
		///<param name="key">Key name</param>
		///<param name="val">New key value to be set</param>
		void SetString (string key, string val);
		
		///<summary>Chceck whether a key is writable by user</summary>
		///<param name="key">Key name</param>
		bool KeyIsWritable (string key);
		
		
		void AddNotify (string key, ConfigNotifyEventHandler notify);
	}
	
	public delegate void ConfigNotifyEventHandler (object o, ConfigNotifyEventArgs args);
	
	public class ConfigNotifyEventArgs : EventArgs
	{
		private string m_key;
		private object m_value;
		
		public ConfigNotifyEventArgs (string key, object val)
		{
			m_key = key;
			m_value = val;
		}
		
		public string Key {
			get { return m_key; }
			set { m_key = value; }
		}
		
		public object Value {
			get { return m_value; }
			set { m_value = value; }
		}
	}
		
	
}
